import allure
from appium.webdriver.common.appiumby import AppiumBy

from ..base.base import Base


class EditMemberInfoPage(Base):
    __DELETE_BUTTON = "删除成员"
    __DELETE_SELF_TIP = "无法删除自己"
    __DIALOG_DELETE_BUTTON = (AppiumBy.ID, "com.tencent.wework:id/cwa")

    @allure.step("点击删除成员按钮")
    def delete_member(self):
        self.swipe_find(self.__DELETE_BUTTON).click()
        image_path = self.screenshot()
        allure.attach.file(image_path, name="删除成员", attachment_type=allure.attachment_type.PNG)

        self.find_ele(self.__DIALOG_DELETE_BUTTON).click()

        from .manage_contact_page import ManageContactPage
        return ManageContactPage(self.driver)
